// pages_report/components/key-data/key-data.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    m1:{
      type: Object,
      default:() => ({})
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    keyData:[]
  },

  /**
   * 组件的方法列表
   */
  methods: {

  },

  observers:{
    'm1': function (dataInfo){
      let keyData = [
        {
          label: '电池健康度',
          img1: '/pages_report/assets/self-report/dianchijiankangdu1.png',
          img2: '/pages_report/assets/self-report/dianchijiankangdu2.png',
          dataList: [{
            label: '电池健康度',
            value: dataInfo.sohValue,
            unit: '%'
          }],
          status: dataInfo.sohResult
        },
        {
          label: '告警',
          img1: '/pages_report/assets/self-report/alarm1.png',
          img2: '/pages_report/assets/self-report/alarm2.png',
          dataList: [{
            label: '告警信息',
            value: dataInfo.alarmNum,
            unit: '条'
          }],
          status: dataInfo.alarmResult
        },
        {
          label: 'SOC准确度',
          img1: '/pages_report/assets/self-report/soc-zhunquedu1.png',
          img2: '/pages_report/assets/self-report/soc-zhunquedu2.png',
          dataList: [{
            label: 'SOC准确度',
            value: dataInfo.socAccuracy?Number(dataInfo.socAccuracy).toFixed(2):'',
            unit: '%'
          },{
            label: 'SOC均匀度',
            value: dataInfo.socLinearity,
            unit: '%'
          }],
          status: dataInfo.socResult
        },
        {
          label: 'BMS测量精度',
          img1: '/pages_report/assets/self-report/bms-celiagnjigndu1.png',
          img2: '/pages_report/assets/self-report/bms-celiagnjigndu2.png',
          dataList: [{
            label: '电压精度',
            value: dataInfo.vAccuracy,
            unit: '%'
          },{
            label: '电流精度',
            value: dataInfo.aAccuracy,
            unit: '%'
          }],
          status: dataInfo.bmsResult
        },
        {
          label: '电池一致性',
          img1: '/pages_report/assets/self-report/dianchiyizhixing1.png',
          img2: '/pages_report/assets/self-report/dianchiyizhixing2.png',
          dataList: [{
            label: '开路电压一致性',
            value: dataInfo.uniformityV,
            unit: '分'
          },{
            label: '温度一致性',
            value: 100 - dataInfo.tmpDiff,
            unit: '分'
          }],
          status: dataInfo.uniformityResult
        },
        {
          label: '充电平均功率',
          img1: '/pages_report/assets/self-report/chongdiansudu1.png',
          img2: '/pages_report/assets/self-report/chongdiansudu2.png',
          dataList: [{
            label: '充电平均功率',
            value: dataInfo.chargingSpeed,
            unit: 'kW'
          }],
          status: dataInfo.chargingSpeedResult
        },
        {
          label: '极值电压',
          img1: '/pages_report/assets/self-report/jizhidianya1.png',
          img2: '/pages_report/assets/self-report/jizhidianya2.png',
          dataList: [{
            label: '电压差',
            value: dataInfo.vDiff?Number(dataInfo.vDiff).toFixed(2):( dataInfo.vDiff == 0 ? 0 : ''),
            unit: 'V'
          },{
            label: '单体最高电压',
            value: dataInfo.cellMaxV,
            unit: 'V'
          },{
            label: '单体最低电压',
            value: dataInfo.cellMinV,
            unit: 'V'
          }],
          status: dataInfo.extremumVResult
        },
        {
          label: '极值温度',
          img1: '/pages_report/assets/self-report/jizhiwendu1.png',
          img2: '/pages_report/assets/self-report/jizhiwendu2.png',
          dataList: [{
            label: '温度差',
            value: dataInfo.tmpDiff,
            unit: '℃'
          },{
            label: '最高温差时单体最高温度',
            value: dataInfo.cellMaxTmp,
            unit: '℃'
          },{
            label: '最高温差时单体最低温度',
            value: dataInfo.cellMinTmp,
            unit: '℃'
          }],
          status: dataInfo.extremumTmpResult
        }
      ]

        this.setData({
          keyData
        })

    }
  }

})
